<?php
/*
 * Created on 06.01.2006
 *
 */

/**
 * Gets the categories the cms content object as a attribute array (by parentname)
 */
class cms_getobjectattributesHandler 
{

    function startElement (& $sender, $attrs)
    {
        if (!$attrs['type'])
            die ("cms:getobjectattributes must have attribute type!\n");
        if (!$attrs['objectid'])
            die ("cms:getobjectattributes must have attribute objectid!\n");
        if (!$attrs['var'])
            die ("cms:getobjectattributes must have attribute var!\n");
        $var = substr($attrs['var'], 1, strlen($attrs['var'])-2);
        if (!preg_match('/\w+/', $var))
            die ("Attribute var must not contain EL code\n");
        $sender->appendCode('$'.$var." = \$cmsdba->getCategoriesAsAttributes(".$attrs['objectid'].", ".$attrs['type'].");\n");        
    }
    
    function endElement (& $sender)
    {
    }

}

?>
